<?php
require 'settings.php';
require 'db.php';
?>

<html>
<head>
<title><?php echo $corp_name?> Industry Manager - Create pricelist</title>

<style type="text/css">
table, th, td
{
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
</style>

</head>
<body>
<h1>Create a new pricelist</h1>
<form id="create_new_pricelist" action="create_pricelist1.php" method="post">
<label>Name of the pricelist:</label>
<input type="text" name="pricelist_name" value="" />

<br />
<label>Markup:</label>
<input type="text" name="pricelist_markup" value="0" />
<label>%</label>

<br />
<label>Replacement discount:</label>
<input type="text" name="pricelist_replacement_discount" value="0" />
<label>%</label>
<br />

<label>Round values to:</label>
<input type="text" name="pricelist_round_to" value="100" />

<br />
<label>Production faclity for this list:</label>
<select name="pricelist_facility">
<option value="0">---Select facility---</option>

<?php
	$get_all_facilities_names->bind_result( $fac_id, $fac_name );
	$get_all_facilities_names->execute();
	while( $get_all_facilities_names->fetch() )
	{
		$output = '<option value="'.$fac_id.'">'.$fac_name.'</option>';
		echo $output;
	}
	$get_all_facilities_names->close();
?>
</select>

<br />
<br />
<label>Choose BPOs which will be used to create products in the pricelist<label><br />
<table>
<tr><td style="text-align:center;font-weight:bold">BPO name</td><td style="text-align:center;font-weight:bold">BPO ME</td><td style="text-align:center;font-weight:bold">BPO PE</td><td style="text-align:center;font-weight:bold">Add?</td></tr>
<?php
	//we need to show all of our corp bpos so we can choose which BPO products to be included in pricelist
	$get_all_corp_bpos->bind_result( $bpo_ID, $bpo_name, $bpo_ME, $bpo_PE );
	$get_all_corp_bpos->execute();
	while( $get_all_corp_bpos->fetch() )
	{
		$output = '<tr><td>'.$bpo_name.'</td><td style="text-align:center">';
		$output .= $bpo_ME.'</td><td style="text-align:center">'.$bpo_PE.'</td><td style="text-align:center">';
		$output .= '<input type="checkbox" name="bpo_'.$bpo_ID.'" /></td></tr>';
		echo $output;
	}

	$get_all_corp_bpos->close();
?>
</table>
<input type="submit" value="Create pricelist" />
</form>

<a href="index.php">Back to main screen</a>
</body>
</html>
